﻿using System;
using System.Linq;
using System.Linq.Expressions;
using ASPItalia.ModelVirtualCasting.Common;
using ASPItalia.ModelVirtualCasting.ObjectModel;

namespace ASPItalia.ModelVirtualCasting.EntityFramework
{
	public class JobTypeRepository : BaseRepository<JobType>, IJobTypeRepository
	{
		public JobTypeRepository(IContextContainer container) : base(container)
		{
		}

		public IQueryable<JobType> GetAll()
		{
			return CurrentObjectSet;
		}

		public IQueryable<JobType> Where(Expression<Func<JobType, bool>> predicate)
		{
			return CurrentObjectSet.Where(predicate);
		}

		public long Count(Expression<Func<JobType, bool>> predicate)
		{
			return CurrentObjectSet.Count(predicate);
		}

		public IJobTypeRepository Include(string path)
		{
			CurrentObjectSet.Include(path);
			return this;
		}

		#region IReadOnlyRepository<IJobTypeRepository,JobType> Members


		public IJobTypeRepository EnableLazyLoading()
		{
			SetLazyLoading(true);
			return this;
		}

		public IJobTypeRepository DisableLazyLoading()
		{
			SetLazyLoading(false);
			return this;
		}

		#endregion
	}
}